<?php
/*
*邮箱设置


*/
require_once '../source/core/run.php';
require_once 'admin.inc.php';
Core_Auth::checkauth("mailsetting");
$action = Core_Fun::rec_post("action");
$smtpserver = Core_Fun::strip_post("smtpserver");
$smtpserverport = Core_Fun::strip_post("smtpserverport");
$smtpusermail = Core_Fun::strip_post("smtpusermail");
$smtpemailto = Core_Fun::strip_post("smtpemailto");
$smtpuser = Core_Fun::strip_post("smtpuser");
$smtppass = Core_Fun::strip_post("smtppass");
//$mailsubject = Core_Fun::rec_post("mailsubject");
//$mailbody = Core_Fun::rec_post("mailbody");

//$mailtype = Core_Fun::rec_post("mailtype");
/*if($smtpserver != '' && $smtpserverport != '' && $smtpusermail != '' && $smtpemailto != '' && $smtpuser != '' && $smtppass != '' && $mailsubject != '' && $mailbody != '' && $mailtype != ''){
		
}*/
if($action == 'update'){
	$sql = "update ".DB_PREFIX."mailsetting set smtpserver = '".$smtpserver."', smtpserverport = ".$smtpserverport.", smtpusermail = '".$smtpusermail."', smtpemailto = '".$smtpemailto."', smtpuser = '".$smtpuser."', smtppass = '".$smtppass."' where  smtpid = 1";
	$result = $db -> query($sql);
	//Core_Fun::halt("保存成功","mail_setting.php",0);
	if($result){
		Core_Fun::halt("保存成功","mail_setting.php",0);	
	}else{
		Core_Fun::halt("保存失败","mail_setting.php",4);	
	}
}
$selsql = "select * from ".DB_PREFIX."mailsetting";
$mail_array = $db -> getRow($selsql);
//define('MAIL_SUBJECT', $mailsubject);//邮件主题
//define('MAIL_BODY', $mailbody);//邮件内容
define('MAAIL_TYPE', 'HTML');//邮件格式（HTML/TXT）,TXT为文本邮件
$tpl->assign("smtpserver", $mail_array['smtpserver']);
$tpl->assign("smtpserverport", $mail_array['smtpserverport']);
$tpl->assign("smtpusermail", $mail_array['smtpusermail']);
$tpl->assign("smtpemailto", $mail_array['smtpemailto']);
$tpl->assign("smtpuser", $mail_array['smtpuser']);
$tpl->assign("smtppass", $mail_array['smtppass']);
$tpl->display(ADMIN_TEMPLATE."mail_setting.tpl");
$tpl->assign("runtime",runtime());
$tpl->assign("copyright",$libadmin->copyright());
?>